/*
 * p3254.cpp
 *
 *  Created on: 2013-7-31
 *      Author: zy
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
const int MOD = 100000000;
int m, n;
int s[600], cnt;
int dp[15][600], corn[15];
bool ok(int x)
{
	if (x & x << 1)
		return 0;
	return 1;
}
bool fit(int x, int k)
{
	if (x & corn[k])
		return 0;
	return 1;
}
void init()
{
	cnt = 0;
	int total = 1 << m;
	for (int i = 0; i < total; i++)
	{
		if (ok(i))
			s[++cnt] = i;
	}
}

int main()
{
	while (scanf("%d%d", &n, &m) != EOF)
	{
		init();
		memset(dp, 0, sizeof(dp));
		for (int i = 1; i <= n; i++)
		{
			int x = 0, t;
			for (int j = 1; j <= m; j++)
			{
				scanf("%d", &t);
				if (t == 0)
					x = x * 2 + 1;
				else
					x = x * 2;
			}
			corn[i] = x;
		}
		for (int i = 1; i <= cnt; i++)
			if (fit(s[i], 1))
				dp[1][i] = 1;
		for (int i = 2; i <= n; i++)
			for (int s1 = 1; s1 <= cnt; s1++)
			{
				if (!fit(s[s1], i))
					continue;
				for (int s2 = 1; s2 <= cnt; s2++)
				{
					if (!fit(s[s2], i - 1))
						continue;
					if (s[s1] & s[s2])
						continue;
					dp[i][s1] = (dp[i][s1] + dp[i - 1][s2]) % MOD;
				}
			}
		int ans = 0;
		for (int i = 1; i <= cnt; i++)
			ans = (ans + dp[n][i]) % MOD;
		printf("%d\n", ans);
	}
	return 0;
}
